import * as storage from '@/util/storage'

export default {
  hasPermi(value) {
	 
    const all_permission = "*:*:*";
    const permissions = JSON.parse(storage.getPermissions()) 

    if (value && value instanceof Array && value.length > 0) {
      const permissionFlag = value

      const hasPermissions = permissions.some(permission => {
        return all_permission === permission || permissionFlag.includes(permission)
      })

      if (!hasPermissions) {
		  return false
      }
	   // console.log('---------value')
	  return true
    } else {
      throw new Error(`请设置操作权限标签值`)
    }
  }
}